package com.dime.basic.api.factory;


import com.dime.basic.api.RemoteGroupService;
import com.dime.basic.api.RemoteHarmService;
import com.dime.basic.api.domain.DimeBasegroup;
import com.dime.basic.api.domain.DimeBaseharm;
import com.dime.basic.api.model.HarmType;
import com.ruoyi.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Component
public class RemoteGroupFallbackFactory implements FallbackFactory<RemoteGroupService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteBaseCombFallbackFactory.class);

    @Override
    public RemoteGroupService create(Throwable cause) {
        log.error("蝶美细项分组服务调用失败:{}", cause.getMessage());
        return new RemoteGroupService() {


            @Override
            public R<List<DimeBasegroup>> getGroupsbyIds(String[] ids) {
                return R.fail("查询细项分组信息:" + cause.getMessage());
            }

            @Override
            public R<List<DimeBasegroup>> getGroupByUserId(String userId) {
                return R.fail("查询用户分组信息:" + cause.getMessage());
            }

            @Override
            public R<List<DimeBasegroup>> getallgroup() {
                return R.fail("查询用户分组信息:" + cause.getMessage());
            }
        };
    }
}
